from flask import Flask
from flask.cli import load_dotenv
from app.clients.prometheus_client import init_prometheus_connect
from app.clients.table_store_client import ts_client

load_dotenv()


def create_app():
    app = Flask(__name__)
    init_prometheus_connect()
    ts_client.init_bts_client()
    from .blueprints.device import device
    app.register_blueprint(device, url_prefix='/device')
    from .blueprints.metrics_adapter import metrics_adapter
    app.register_blueprint(metrics_adapter, url_prefix='/metrics/adapter')
    from .blueprints.prometheus import prometheus
    app.register_blueprint(prometheus, url_prefix='/prometheus')
    return app
